package org.hu.controller;

import org.hu.model.Employee;
import org.hu.model.MeetingDTO;
import org.hu.service.MeetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 最新通知
 * @author Htrees
 */
@Controller
public class NotificationsController {
    @Autowired
    MeetingService meetingService;

    /**
     * 最新通知页面
     * @param model
     * @param session
     * @return notifications
     */
    @RequestMapping("/notifications")
    public String notifications(Model model, HttpSession session){
        Employee currentuser = (Employee) session.getAttribute("currentuser");
        List<MeetingDTO> smts = meetingService.getSevenDaysMt(currentuser.getEmployeeid());
        List<MeetingDTO> cmts = meetingService.getMtByStatus(1);
        model.addAttribute("cmts",cmts);
        model.addAttribute("smts",smts);
        return "notifications";
    }


}
